import React, { Component } from 'react'
import "./App.css"
export default class App extends Component {
  componentDidMount(){
    let box =document.createElement("div")
    box.setAttribute("id","box")
     box.style.display="none"
    document.body.appendChild(box)
  }

  state={
    show:false
  }
  handleClick=()=>{
    this.setState({
      show:!this.state.show
    })
    let box =  document.getElementById("box")
    if(this.state.show){
      box.style.display="block"
    }else{

      box.style.display="none"
    }
  }
  
  render() {
    return (
      <div>
        <button onClick={this.handleClick}>显示弹窗</button>
      </div>
    )
  }
}
